import React, { Component, View } from 'react-native';
import propTypes from 'prop-types';
import { Map } from 'immutable';

class Login extends Component {
  constructor(props) {
    super(props);
    this.handlerLogin = this.handlerLogin.bind(this);
  }

  handlerLogin() {
    this.props.doLogin();
  }

  render() {
    return (
      <View>
        <button onClick={this.handlerLogin} type="primary">Test</button>
      </View>
    );
  }
}

/** 定义propTypes */
Login.propTypes = {
  /** 登录信息 */
  loginInfo: propTypes.oneOfType(Map).isRequired,
  /** 执行登录 */
  doLogin: propTypes.func.isRequired,
};

export default Login;
